listbox: Store child iter in a variable when removing
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 2 Aug 2018 06:29:33 +0000 (03:29 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 2 Aug 2018 13:24:12 +0000 (10:24 -0300)
commit5596feae9b51563a33f1bffc6a370e6ba556adb7
treeef0ba52868fd2ff1fc7d44f1e215c5f2b7f6a88a
parent50d5666db04f54d0fd6f777348af6c6533c00b2f
listbox: Store child iter in a variable when removing

Unparenting a GtkListBoxRow can drop its last reference, which
will free its memory. Right after unparenting, though, we were
accessing the row's iter - which assumes that the row is still
alive. This causes a crash when, for example, binding two or
more models to the listbox.

Fix that by storing the iter in a variable, and not trying to
access it after unparenting. After unparenting, the variables
that are potentially garbage were explicitly assigned NULL for
clarity.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1258
gtk/gtklistbox.c